/*
 * Copyright 2002-2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.core.type;

import java.util.Set;

/**
 * Interface that defines abstract access to the annotations of a specific
 * class, in a form that does not require that class to be loaded yet.
 *
 * @author Juergen Hoeller
 * @author Mark Fisher
 * @author Phillip Webb
 * @author Sam Brannen
 * @since 2.5
 * @see StandardAnnotationMetadata
 * @see org.springframework.core.type.classreading.MetadataReader#getAnnotationMetadata()
 * @see AnnotatedTypeMetadata
 *
 * Spring对于某个类上的注解的抽象建模接口。也包含了类的每个方法的元数据和注解信息MethodMetadata。可以这么简单的理解 :
 * AnnotationMetadata = 类本身元数据 + 类上的注解信息 + Set(每个方法的元数据 + 注解信息)
 *
 * 这里面 :
 *
 * 类本身元数据的Spring抽象建模接口是ClassMetadata。
 * 方法的元数据 + 注解信息对应的Spring抽象建模接口是MethodMetadata
 */
public interface AnnotationMetadata extends ClassMetadata, AnnotatedTypeMetadata {

	/**
	 * 拿到当前类上所有的注解的全类名（注意是全类名）
	 */
	Set<String> getAnnotationTypes();

	/**
	 *拿到指定的注解类型
	 */
	Set<String> getMetaAnnotationTypes(String annotationName);

	/**
	 * 是否包含指定注解 （annotationName：全类名）
	 */
	boolean hasAnnotation(String annotationName);

	/**
	 * 这个厉害了，用于判断注解类型自己是否被某个元注解类型所标注
	 */
	boolean hasMetaAnnotation(String metaAnnotationName);

	/**
	 * Determine whether the underlying class has any methods that are
	 * annotated (or meta-annotated) with the given annotation type.
	 * @param annotationName the fully qualified class name of the annotation
	 * type to look for
	 *    类里面只有有一个方法标注有指定注解，就返回true
	 */
	boolean hasAnnotatedMethods(String annotationName);

	/**
	 * 返回所有的标注有指定注解的方法元信息。注意返回的是MethodMetadata 原理基本同上
	 */
	Set<MethodMetadata> getAnnotatedMethods(String annotationName);

}
